part of '../page.dart';

class _UseCaseAnimatedView extends AnimatedWidget {
  _UseCaseAnimatedView({
    required this.presentationModel,
    required this.onExampleSubmitted,
    required this.onTranslationSubmitted,
    required this.onUseCaseRemove,
    super.key,
  }) : super(
          listenable: presentationModel.appearanceAnimation,
        );

  final _UseCaseInputPresentationModel presentationModel;
  final VoidCallback onExampleSubmitted;
  final VoidCallback onTranslationSubmitted;
  final VoidCallback onUseCaseRemove;

  @override
  Widget build(BuildContext context) {
    return ClipRect(
      child: Align(
        alignment: Alignment.topCenter,
        heightFactor: presentationModel.appearanceAnimation.value,
        child: Column(
          children: [
            const TileGap(),
            UseCaseEditingTileGroup(
              exampleShakeAnimationController: presentationModel.exampleShakeAnimationController,
              translationShakeAnimationController: presentationModel.translationShakeAnimationController,
              exampleEditingController: presentationModel.exampleTextEditingController,
              translationEditingController: presentationModel.translationTextEditingController,
              exampleFocusNode: presentationModel.exampleTextFieldFocusNode,
              translationFocusNode: presentationModel.translationTextFieldFocusNode,
              onExampleSubmitted: onExampleSubmitted,
              onTranslationSubmitted: onTranslationSubmitted,
              onUseCaseRemove: onUseCaseRemove,
            ),
          ],
        ),
      ),
    );
  }
}
